/*
*    UNIVERSIDADE DE SÃO PAULO.
*    Author: Marco Aurélio Gerosa (gerosa@ime.usp.br)
*
*    This file is part of Groupware Workbench (http://www.groupwareworkbench.org.br).
*
*    Groupware Workbench is free software: you can redistribute it and/or modify
*    it under the terms of the GNU Lesser General Public License as published by
*    the Free Software Foundation, either version 3 of the License, or
*    (at your option) any later version.
*
*    Groupware Workbench is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU Lesser General Public License for more details.
*
*    You should have received a copy of the GNU Lesser General Public License
*    along with Swift.  If not, see <http://www.gnu.org/licenses/>.
*/
package br.org.groupwareworkbench.aun.news;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import br.org.groupwareworkbench.core.bd.GenericEntity;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name="News")
public class News extends GenericEntity {

    private static final long serialVersionUID = 4820172445307827729L;

    // adicionado do código do original da AUN
    private String codNews;

    private String title;

    private String subTitle;

    @Column(columnDefinition="MEDIUMTEXT")
    private String body;

    private String lead;

    private String category;

    private String relevance;

    private String status;

    @Temporal(TemporalType.TIMESTAMP)
    private Date closeDate;

    @Temporal(TemporalType.TIMESTAMP)
    private Date publishDate;

    @Temporal(TemporalType.TIMESTAMP)
    private Date sendDate;

    public void News() {
        this.closeDate = new Date();
        this.publishDate = new Date();
        this.sendDate = new Date();
    }

    @Override
    public boolean equals(Object o) {
        if (!(o instanceof News)) return false;
        News other = (News) o;
        return other.getTitle().equals(this.getTitle());
    }

    @Override
    public int hashCode() {
        return title == null ? 0 : title.hashCode();
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getSubTitle() {
        return subTitle;
    }

    public void setSubTitle(String subTitle) {
        this.subTitle = subTitle;
    }

    public String getBody() {
        return body;
    }

    public void setBody(String body) {
        this.body = body;
    }

    public String getCodNews() {
        return codNews;
    }

    public void setCodNews(String codNews) {
        this.codNews = codNews;
    }

    public String getLead() {
        return lead;
    }

    public void setLead(String lead) {
        this.lead = lead;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public String getRelevance() {
        return relevance;
    }

    public void setRelevance(String relevance) {
        this.relevance = relevance;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Date getCloseDate() {
        return closeDate;
    }

    public void setCloseDate(Date closeDate) {
        this.closeDate = closeDate;
    }

    public Date getPublishDate() {
        return publishDate;
    }

    public void setPublishDate(Date publishDate) {
        this.publishDate = publishDate;
    }

    public Date getSendDate() {
        return sendDate;
    }

    public void setSendDate(Date sendDate) {
        this.sendDate = sendDate;
    }
}

